package com.nk.iexam;

import com.nk.iexam.models.Category;

import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

@SuppressWarnings("deprecation")
public class ReviewActivity extends TabActivity
{
	public static final String CATEGORY = "Category";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      //Remove title bar
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        //Remove notification bar
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
        		WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_review); 

        Category category = (Category) getIntent().getSerializableExtra(CATEGORY);
        String knowdledgeTabName = getString(R.string.knowdledge_tab_title);
        String qaTabName = getString(R.string.qa_tab_title);
       
        TabHost tabHost = getTabHost();
        TabSpec knowdledgeTabSpec = tabHost.newTabSpec(knowdledgeTabName);
        // setting Title and Icon for the Tab
        knowdledgeTabSpec.setIndicator(knowdledgeTabName, getResources().getDrawable(R.drawable.icon_knowdledge_tab));
        Intent knowdledgeIntent = new Intent(this, KnowdledgeActivity.class);
        knowdledgeIntent.putExtra(CATEGORY, category);
        knowdledgeTabSpec.setContent(knowdledgeIntent);
 
        TabSpec qaTabSpec = tabHost.newTabSpec(qaTabName);
        qaTabSpec.setIndicator(qaTabName, getResources().getDrawable(R.drawable.icon_qa_tab));
        Intent qaIntent = new Intent(this, QAActivity.class);
        qaIntent.putExtra(CATEGORY, category);
        qaTabSpec.setContent(qaIntent);
 
        // Adding all TabSpec to TabHost
        tabHost.addTab(knowdledgeTabSpec);
        tabHost.addTab(qaTabSpec);
    }
    
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        //getMenuInflater().inflate(R.menu.activity_subject, menu);
        return true;
    }
}
